package study.枚举;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author 刘伟涛
 * @Date 2023/6/30 9:36
 **/
public class Demo02 {
    public static void main(String[] args) {
        ProductEnum terminal = ProductEnum.TERMINAL;
        System.out.println(terminal.obtainSource());

        ExecutorService executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().availableProcessors() * 2, 20_000L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<>(1_000),
                new ThreadFactoryBuilder().setNameFormat("caller_runs_policy_pool-%d").build(),
                new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
